#ifndef JBK_AI_GA_PETERS_GA_H
#define JBK_AI_GA_PETERS_GA_H

#include "GeneticAlgorithm.h"

#define PETERS_GA_PARENTS_COEFFICIENT         0.4
#define PETERS_GA_RANDOM_PARENT_COEFFICIENT   0.01

namespace GA {
class Individual;
class PetersGA : public GeneticAlgorithm {
public:
	/* ctor */
	PetersGA(int nPopulation, int nPopulationChildren, Individual* const* population);
	
	/* dtor */
	~PetersGA();

	/* evolve one step */
	void evolveOneStep();

	/* best individuals */
	const Individual& getBestIndividualCurrent() const;
	const Individual& getBestIndividualEver() const; 

private:
         /* population sizes */
        int _nPopulation;         /* adults   */
        int _nPopulationChildren; /* children */

         /* populations */
        Individual** _population;         /* adults   */
        Individual** _populationChildren; /* children */

         /* best individuals */
        Individual* _bestIndividualCurrent; /* current */
        Individual* _bestIndividualEver;    /* ever    */

        Individual* _pickParent() const; /* pick a parent           */
        void _evaluatePopulation();      /* evaluate population     */
        void _sortPopulation();          /* sort population         */
        void _updateBestIndividuals();   /* update best individuals */
};
} // GA

#endif	// JBK_AI_GA_PETERS_GA_H

